Import("env")

public_headers = [("include/", "include/%(name)s/"),
                  ("include/lwip/", "include/%(name)s/"),
                  ("include/ipv4/lwip/", "include/%(name)s/"),
                  ("include/arch/", "include/%(name)s/arch/"),
                  ("include/netif/", "include/%(name)s/netif/")]

srccorelist = """core/inet.c core/ipv4/icmp.c core/ipv4/ip.c core/ipv4/ip_addr.c
		 core/mem.c core/memp.c core/netif.c core/pbuf.c core/stats.c
		 core/sys.c core/tcp.c core/tcp_input.c
		 core/tcp_output.c core/tcp_pcb.c core/udp.c"""
srcotherlist = "netif/etharp.c sos/sosif.c"

liblist = "c ixp_osal ixp400_xscale_sw"

cppdefines = env.scons_env["CPPDEFINES"]+["LWIP_DEBUG", "l4aos"]
if env.machine.endian == "big":
    cppdefines += [("BIG_ENDIAN", 1)]
else:
    cppdefines += [("LITTLE_ENDIAN", 1)]

cpppath    = env.scons_env["CPPPATH"]+["#sos"] # Grab sos headers
cc_warnings = ["no-redundant-decls", "no-format"]
  
lib = env.KengeLibrary("lwip",
	            source = Split(srccorelist) + Split(srcotherlist),
	            public_headers = public_headers,
		    LIBS = Split(liblist),
		    CPPDEFINES = cppdefines,
		    CPPPATH = cpppath,
		    CC_WARNINGS = cc_warnings)

Return("lib")

# vim: filetype=python
